<?php
    include('lang.php');
    include('function/function.php');
    
    $product_id = $_GET['product_id'];
    
    $con = db_connect();
    $sql = "SELECT * FROM products WHERE product_id=$product_id";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Pathom Furniture (1994) &amp; Pathom Interior Contract</title>
	<link rel="shortcut icon" href="images/favicon.ico" />
        
        <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
        
        <link rel="stylesheet" type="text/css" href="<?php echo SITEURL; ?>css/reset.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo SITEURL; ?>css/order.css" />
	
        <!--[if IE 6]>
	<link href="<?php echo SITEURL; ?>css/order_ie6.css" rel="stylesheet" />
	<script language="javascript" type="text/javascript" src="<?php echo SITEURL; ?>js/DD_belatedPNG_0.0.8a-min.js"></script>
	<script>
	    DD_belatedPNG.fix('img');
	    DD_belatedPNG.fix('.png_bg');
	</script>
        <![endif]-->
        <!--[if IE 7]>
	<link href="<?php echo SITEURL; ?>css/order_ie7.css" rel="stylesheet" />
        <![endif]-->
        <!--[if IE 8]>
	<link href="<?php echo SITEURL; ?>css/ie8.css" rel="stylesheet" />
        <![endif]-->
	
	<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
    <script src="js/languages/jquery.validationEngine-th.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/js.func.js" type="text/javascript" charset="utf-8"></script>
    <script>
	$(document).ready(function(){
            $("#order_frm").validationEngine();
            
            $('#order_frm_button').click(function(){
                if( $("#order_frm").validationEngine('validate') ){
                    $('#order_frm_button').css('display','none');
                    $('#ajax_loader').css('display','inline');
                    var frm_data = $('#order_frm').serialize();
                    
                    $.post("function/sent-order-mail.php", frm_data ,function(data){
                        if(trim(data)=='success'){
                            alert('ข้อความถูกส่งเรียบร้อยแล้ว กรุณารอการติดต่อกลับค่ะ');
                            $("#order_frm")[0].reset();
                        }else{
                            alert('ไม่สามารถส่งข้อความได้ กรุณาลองใหม่อีกครั้งค่ะ');
                        }
                        $('#order_frm_button').css('display','inline');
                        $('#ajax_loader').css('display','none');
			parent.$.fn.colorbox.close();
                    });
                }
            });
        });
    </script>
    </head>
    <body>
        <div id="wrapper">
            <div class="box_top">&nbsp;</div>
            <div id="product_img" class="box_middle">
                <div id="product_img_">
                    <img src="<?php echo SITEURL; ?>images/products/<?php echo $product_id,'/',$row['product_img']; ?>" alt="<?php echo $row['product_title']; ?>"/>
                </div>
                <div id="product_img_thumb">
                    <img src="<?php echo SITEURL; ?>images/products/<?php echo $product_id,'/',$row['product_img_2']; ?>" alt="<?php echo $row['product_title']; ?>" class="img_first"/>
                    <img src="<?php echo SITEURL; ?>images/products/<?php echo $product_id,'/',$row['product_img_3']; ?>" alt="<?php echo $row['product_title']; ?>" class="img_first"/>
                    <img src="<?php echo SITEURL; ?>images/products/<?php echo $product_id,'/',$row['product_img_4']; ?>" alt="<?php echo $row['product_title']; ?>"/>
                </div>
                <div class="clear">&nbsp;</div>
                <div id="product_name">
                    <?php echo $row['product_title']; ?>
                </div>
            </div>
            <div class="box_bottom">&nbsp;</div>
            
            <div class="box_top">&nbsp;</div>
            <div id="product_detail" class="box_middle">
                <div id="product_dimension">
                    <table>
                        <tr>
                            <td class="td_left"><?php _l('order-width'); ?></td><td><?php echo $row['product_width']; ?><td>
                        </tr>
                        <tr>
                            <td class="td_left"><?php _l('order-depth'); ?></td><td><?php echo $row['product_depth']; ?><td>
                        </tr>
                        <tr>
                            <td class="td_left"><?php _l('order-height'); ?></td><td><?php echo $row['product_height']; ?><td>
                        </tr>
                    </table>
                </div>
                <div id="product_detail_">
                    <?php echo $row['product_detail']; ?>
                </div>
            </div>
            <div class="box_bottom">&nbsp;</div>
            
            <div class="box_top">&nbsp;</div>
            <div id="product_order_frm" class="box_middle">
                <form id="order_frm">
                    <table>
                        <tr>
                            <td class="td_left"><?php _l('contact-name'); ?> : </td><td><input type="text" name="name" class="validate[required]" id="req1"/><td>
                        </tr>
                        <tr>
                            <td class="td_left"><?php _l('contact-tel'); ?> : </td><td><input type="text" name="tel" class="validate[required,custom[phone]]" id="req2"/><td>
                        </tr>
                        <tr>
                            <td class="td_left"><?php _l('contact-email'); ?> : </td><td><input type="text" name="email" class="validate[required,custom[email]]" id="req3"/><td>
                        </tr>
                        <tr>
                            <td class="td_button" colspan="2">
				<input type="hidden" name="product_id" value="<?php echo $product_id; ?>"/>
				<img src="<?php echo SITEURL; ?>images/contact_frm_button_<?php echo $_SESSION['lang']; ?>.jpg" alt="Send" id="order_frm_button"/>
				<img src="<?php echo SITEURL; ?>images/ajax-loader.gif" class="display_none" id="ajax_loader" />
			    </td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="box_bottom">&nbsp;</div>
        </div>
    </body>
</html>